<?php
namespace org\crawlgenie\application\base;
use org\crawlgenie\application\environment\Request;

/**
 * Description of Application
 *
 * @author Jinson
 */
class Application {
    private $startTime, $endTime, $renderTime;


    public static function getModulePath() {
        if(Request::getParam('mod') === null) {
            return GBT_MODULES_DIR . DS . Request::getParam('default');
        } else {
            return GBT_MODULES_DIR . DS . Request::getParam('mod');
        }
    }



    public static function getMicroTime() {
        list($usec, $sec) = explode(" ",microtime());
        return ((float)$usec + (float)$sec);
    }

    
    public function setStartTime() {
        $this->startTime = self::getMicroTime();
    }


    public function getRenderTime() {
        $this->startTime = (empty($this->startTime)) ? 0 : $this->startTime;
        $this->endTime = self::getMicroTime();
        $this->renderTime = sprintf('%.8f', $this->endTime - $this->startTime);
        return $this->renderTime;
    }

}
?>
